/*
 * TerritoryView.java
 *
 * @author Michael Hansen
 * @author Lukas Thuernagel
 * @author Soeren Warszus
 */

package risk.game;

import java.awt.*;
import javax.swing.*;

public class TerritoryView extends JPanel{
    
    /**
     * Das zugehoerige Model
     */
    private Territory country;
    /**
     * JLabel auf dem die Armeegroesse steht
     */
    private JLabel label;
    
    /** 
     * TerritoryView
     * 
     * @param Territory c Country, dessen Armeeanzahl angezeigt werden soll. Das Model zu diesem View
     */
    public TerritoryView(Territory c) {
        this.country = c;
        //country.registerArmyDisplay(this);
        this.setLocation(country.getMidpoint());
        label = new JLabel();
        label.setFont(new Font("Times New Roman", Font.BOLD, 8));
        label.setText(new Integer(country.getArmySize()).toString());
        this.add(label);
        this.setSize(label.getSize());
        this.setBackground(Color.WHITE);
        this.setVisible(true);
    }
    
    /**
     * Anzeigen der Armeeanzahl
     *
     * @param int size Zahl der Armeen
     */
    public void setArmySize(int size){
        label.setText(new Integer(country.getArmySize()).toString());
        label.setVisible(true);
    }
}